# 封装
# 动物类
class Animals:
  def __init__(self, name, age, species):
    self.__name = name
    self.__age = age
    self.__species = species

  def sound(self):
    '''
    叫声
    '''
    pass

  def action(self):
    '''
    特长
    '''
    pass

  def getName(self):
    return self.__name

  def getAge(self):
    return self.__age

  def getSpecies(self):
    return self.__species


# 继承
# 猫类
class Cat(Animals):
  def __init__(self, name, age, species):
    super().__init__(name, age, species)

  def sound(self):
    return "喵喵~"

  def action(self):
    super().action()
    return "小猫会抓老鼠！"


# 狗类
class Dog(Animals):
  def __init__(self, name, age, species):
    super().__init__(name, age, species)

  def sound(self):
    return "旺旺！"

  def action(self):
    super().action()
    return "小狗会看家！"


# 鸟类
class Bird(Animals):
  def __init__(self, name, age, species):
    super().__init__(name, age, species)

  def sound(self):
    return "啾啾-"

  def action(self):
    super().action()
    return "小鸟会唱歌！"


cat1 = Cat("玛奇朵", 2, "英国短毛猫")
dog1 = Dog("尼莫", 2, "柯基")
bird1 = Bird("啾太郎", 1, "麻雀")

# 多态
zoo = [cat1, dog1, bird1]

for animal in zoo:
  print(f"{animal.getName()}是一只{animal.getAge()}岁的{animal.getSpecies()}，叫声是{animal.sound()}，{animal.action()}")
